const cars = [
  {
    name: '1',
    horsepower: 660,
    dollar_value: 1000,
    in_stocks: true
  },
  {
    name: '1',
    horsepower: 660,
    dollar_value: 1500,
    in_stocks: false
  }
]

// 1.
const getInStocks = (last) => _.prop('in_stocks', last)
const fp1 = _.flowRight(getInStocks, _.last)


// 2.
const getName = (last) => _.prop('name', last)
const fp2 = _.flowRight(getName, _.first)


// 3.
const dollarValues = (cars) => {
  return _.map((car) => {
    return car.dollar_value
  },cars)
}
const _average = (xs) => {
  return _.reduce(_.add,0,xs) / xs.length
}
const fp3 = _.flowRight(_average, dollarValues)

// 4
const toLowerCase = (arr) => {
  return _.map((str) => {
    return str.toLowerCase()
  },arr)
}
const _uderscore = _.replace(/\W+/g, '_')
const toUderscore = (arr) => {
  return _.map((str) => {
    return _uderscore(str)
  },arr)
}
const fp4 = _.flowRight(toUderscore, toLowerCase)

